Plugins - Better Be Safe Than Sorry
Most of us have plugins installed when it comes to our WordPress. Sure, plugins are handy but they can become disastrous especially when you upgrade your WordPress or more importantly, deactivate certain plugins. For the unfortunates, it may broke your blog and further refuse to load any longer.
Worst case scenario, you’ll be greeted with this, “Fatal error: Call to undefined function”. A nightmare, huh? Worry not. This tip might help you out.
Most plugins create form of php command in order to work. Without it, the plugins cannot be called the whole page won’t load properly. In order to overcome this, I suggest you to insert the command “if“; indirectly making the plugins optional.
Let us look at one of the plugin I installed in this blog that is “Similar Post” from Rob Marsh. The supplied command code looks like this:
<?php similar_posts(); ?>
The author did create an uninstall page where you can safely deactivate and uninstall this plugin. That’s good but what if it doesn’t? As my safety precaution, I modified the command, making it looks like this:
<?php if(function_exists('similar_posts')) { similar_posts(); } ?>
The benefit of extra command is that I don’t need to worry if I accidentally deactivate the plugin or due to unexpected database errors. This blog still can load without problem. The only drawback is, I have to manually revert to the original code shall I need to upgrade it.
Whatever it is, you decide. As for me, it’s better to be safe than sorry.
Related entries
Share your thoughts
